﻿using Anke.SHManage.MSSQLDAL.TJDAL;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    public partial class TJ_BLXFFSCGModeWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPage();
            }

        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            BindReportDataSource();
        }
        private void InitPage()
        {
            this.selectyear.Text = Convert.ToString(DateTime.Now.Year);
            BindReportDataSource();
        }
        protected void BindReportDataSource()
        {
            string selectyear = Convert.ToString(this.selectyear.Text);
            string txtCenterAuditResult = Convert.ToString(this.txtCenterAuditResult.Text);
        


            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/TJ_XFFSCG.rdlc");
            Microsoft.Reporting.WebForms.ReportParameter st = new Microsoft.Reporting.WebForms.ReportParameter("year", selectyear);
            this.ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { st });

            TJDAL dal = new TJDAL();

            DataTable dt = dal.Get_TJ_XFFSCG(selectyear, txtCenterAuditResult);
            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetForXFFSCG", dt));

            this.ReportViewer1.LocalReport.Refresh();
        }

    }
}